<?xml version='1.0' encoding='UTF-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<f:view encoding="ISO-8859-1">
	<h:head>
		<title>Busca de produtos</title>
		<h:outputStylesheet library="css" name="styles.css" />
		<h:outputScript library="js" name="scripts.js" />
	</h:head>
	<h:body>
		<h:form id="frmSrcProduct" styleClass="frm"
			rendered="#{loginBean.isLogged()}">
			
			<ui:include src="../../templates/menu.xhtml" />
			
			<p:growl id="messages" showDetail="true" sticky="true"/>
				
			<p:panel id="searchPanelProduct" header="Busca de produtos" styleClass="searchPanelPrincipal">
				<p:dataTable id="tblProducts" var="pro" value="#{productBean.productList}"
					widgetVar="productsTable" filteredValue="#{productBean.filteredProducts}"
					emptyMessage="Não foi encontrado nenhum produto com a característica informada!"
					paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					paginator="true" rows="10">
					
					<p:column headerText="CÓDIGO" filterBy="#{pro.barcode}"
						filterMatchMode="contains">
						#{pro.barcode}
					</p:column>
					<p:column headerText="NOME" filterBy="#{pro.name}"
						filterMatchMode="contains">
						#{pro.name}
					</p:column>
					<p:column headerText="NÚMERO" filterBy="#{pro.proNumber}"
						filterMatchMode="contains">
						#{pro.proNumber}
					</p:column>
					<p:column headerText="CAPA" filterBy="#{pro.cover}"
						filterMatchMode="contains">
						#{pro.cover}
					</p:column>
					<p:column headerText="RECEBIDA EM">
						<p:calendar value="#{pro.receiptDate}" disabled="true" pattern="dd/MM/yyyy"/>
					</p:column>
					<p:column headerText="DEVOLVIDA EM">
						<p:calendar value="#{pro.returnDate}" disabled="true" pattern="dd/MM/yyyy"/>
					</p:column>
					<p:column headerText="QTD">
						#{pro.qtd}
					</p:column>
					<p:column headerText="PREÇO">
						<h:outputText value="#{pro.price}">
							<f:convertNumber maxFractionDigits="2" groupingUsed="true" currencySymbol="R$"
								maxIntegerDigits="4" type="currency" currencyCode="BRL"/>
						</h:outputText>
					</p:column>
				</p:dataTable>
			</p:panel>
		</h:form>
		<h:form	rendered="#{!loginBean.isLogged()}">
			<h1 align="center">
				<h:outputText value="Acesso não autorizado a esta página!" />
			</h1>
			<h1 align="center">
				<h:graphicImage value="#{resource['images/general/forbidden.png']}" />
			</h1>
		</h:form>
		<ui:include src="../../templates/footer.xhtml" />
	</h:body>
</f:view>
</html>